﻿@using ADShop.Models
@using ADShop.Repository
@{
    Member m = ViewBag.InfoMember;
}

@*<script type="text/javascript">
    function ChangePassword()
    {
        var email = document.getElementsByName("lbEmail").value;
        var cpw = document.getElementsByName("tbCurrentPassword").value;
        var npw = document.getElementsByName("tbNewPassword").value;
        var ncpw = document.getElementsByName("tbConfirmNewPassword").value;

        if (npw != ncpw) {
            alert("Xác nhận mật khẩu không đúng !");
        }
        else {
            $.post("/ManagerMember/ChangePassword", new { "email": email, "cpw": cpw, "npw": npw },
                function (data) {
                    if (data.Code == 0) {
                        alert("Đổi mật khẩu thành công cho tài khoản" + email);
                    }
                    if (data.Code == 1) {
                        alert("Đổi mật khẩu thất bại . Xin vui lòng thử lại. Hoặc liên hệ Admin : 01658.198.197");
                    }
                });
        }
    }
</script>*@

<div class="box">
    <div class="box-heading"><span>Infomartion Member</span></div>
    <div class="box-content">
        <div class="box-product">
            <table>
               <thead>
                   <tr><td><b><font color="Organce" size="3">Basic Information</font></b></td></tr>
                   <tr>
                       <td>User ID : </td>
                       <td>@m.IDUser</td>
                   </tr>
                   <tr>
                       <td>Privilege : </td>
                       @if(m.IDPrivilege == 1)
                       {
                           <td>Administrator</td>
                       }
                       else
                       {
                           <td>Member</td> 
                       }
                   </tr>
                   <tr>
                       <td>Rewards : </td>
                       <td>@m.RewardsUser</td>
                   </tr>
                   <tr><td><b><font color="Organce" size="3">More Information</font></b></td></tr>
                   <tr>
                       <td>First Name : </td>
                       <td>@Html.TextBox("tbFirstName", m.InfoMember.FirstName)</td>
                   </tr>
                   <tr>
                       <td>Last Name : </td>
                       <td>@Html.TextBox("tbLastName",m.InfoMember.LastName)</td>
                   </tr>
                   <tr>
                       <td>Fax : </td>
                       <td>@Html.TextBox("tbFax",m.InfoMember.Fax)</td>
                   </tr>
                   <tr>
                       <td>Number Phone : </td>
                       <td>@Html.TextBox("tbNumerPhone", m.InfoMember.NumberPhone)</td>
                   </tr>
                   <tr>
                       <td>Number Phone : </td>
                       <td>@Html.TextBox("tbNumerPhone", m.InfoMember.NumberPhone)</td>
                   </tr>
                   <tr>
                       <td>Number Card Number : </td>
                       <td>@Html.TextBox("tbNumerCardMember", m.InfoMember.NumberCardMember)</td>
                   </tr>
                   <tr>
                       <td>Company : </td>
                       <td>@Html.TextBox("tbCompay", m.InfoMember.Company)</td>
                   </tr>
                   <tr>
                       <td>Representative : </td>
                       <td>@Html.TextBox("tbRepresentative", m.InfoMember.Representative)</td>
                   </tr>
                   <tr>
                       <td>Tax Code : </td>
                       <td>@Html.TextBox("tbTaxCode", m.InfoMember.TaxCode)</td>
                   </tr>
                   <tr>
                       <td>Address : </td>
                       <td>@Html.TextBox("tbAdress", m.InfoMember.Address)</td>
                   </tr>
                   <tr>
                       <td> 
                          Action :
                       </td>
                       <td>
                           <input type="submit" value="Update Info" class="button" />
                       </td>
                   </tr>
                   <tr><td><b><font color="Organce" size="3">Change Password</font></b></td></tr>
                   @using (Html.BeginForm("ChangePassword", "ManagerMember", new  { id = @m.IDUser }, FormMethod.Post))
                   {
                       <tr>
                           <td>Current Password : </td>
                           <td><input type="password" name="tbCurrentPassword" /></td>
                       </tr>
                       <tr>
                           <td>New Password : </td>
                           <td><input type="password" name="tbNewPassword" /></td>
                       </tr>
                       <tr>
                           <td>Confirm New Password : </td>
                           <td><input type="password" name="tbConfirmNewPassword" /></td>
                       </tr>
                       <tr>
                           <td>Action : </td>
                           <td><input type="submit" value="Update Password" class="button"/></td>
                       </tr>
                        <tr>
                            <td></td>
                           <td><font color="red"><b>@Global.Error</b></font></td>
                       </tr>
                   }
               </thead>
            </table>
        </div>
    </div>
</div>
